package com.pattern.factory.simplefactory.pizza.improve;

import com.pattern.factory.simplefactory.pizza.CheesePizza;
import com.pattern.factory.simplefactory.pizza.GreekPizza;
import com.pattern.factory.simplefactory.pizza.Pizza;

/**
 * @author 冯志立
 * @create 2019-10-17 17:33
 */
public class SimpleFactory {
    public Pizza createPizza(String orderType){
        Pizza pizza = null;
        if (orderType.equals("greek")) {
            pizza = new GreekPizza();
            pizza.setName("greek");
        } else if (orderType.equals("cheese")) {
            pizza = new CheesePizza();
            pizza.setName("cheese");
        }else if (orderType.equals("pepper")) {
            pizza = new CheesePizza();
            pizza.setName("pepper");
        }
        return pizza;
    }
}
